# Database Modelling


# ERD

Entity Relationship Diagrams

  • Lucidchard

# Entities

  • Entities - rows
  • Attributes -columns

# Relationships

Describe, how the elements interact with each other

# Cardinality

Erd cardinality

Think: what is the minimum and maximum:

Erd cardinality

# Primary Key

Rules

  1. unique
  2. never changing
  3. never null
  • one PK per table

# Foreign Key

  • Foreign Key dont have to be uniqe, they can be repeated
  • There can be multiple Foreign Keys in one entity
Erd cardinality

# Composite Primary Key

when 2 or more attributes are used to uniquly identify a record

# Rules:
  1. Use the fewest amout of attributes possible

  2. Don't use attributes that might change

    Erd cardinality

# Bridge Table

Breaks up the many-to-many relationship